package com.bbzn.device.client.service.impl;

import com.bbzn.device.client.dataobject.AlarmHis;
import com.bbzn.device.client.dto.announce.AnnouncementDTO;
import com.bbzn.device.client.utils.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.bbzn.device.client.dao.announce.AnnouncementMapper;
import com.bbzn.device.client.dataobject.Announcement;
import com.bbzn.device.client.service.AnnouncementService;
@Service
public class AnnouncementServiceImpl implements AnnouncementService{

    @Resource
    private AnnouncementMapper announcementMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return announcementMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Announcement record) {
        return announcementMapper.insert(record);
    }

    @Override
    public int insertOrUpdate(Announcement record) {
        return announcementMapper.insertOrUpdate(record);
    }

    @Override
    public int insertOrUpdateSelective(Announcement record) {
        return announcementMapper.insertOrUpdateSelective(record);
    }

    @Override
    public int insertSelective(Announcement record) {
        return announcementMapper.insertSelective(record);
    }

    @Override
    public Announcement selectByPrimaryKey(Long id) {
        return announcementMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Announcement record) {
        return announcementMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Announcement record) {
        return announcementMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<Announcement> findByAll(Announcement announcement) {
        return announcementMapper.findByAll(announcement);
    }

    @Override
    public int updateBatch(List<Announcement> list) {
        return announcementMapper.updateBatch(list);
    }

    @Override
    public int updateBatchSelective(List<Announcement> list) {
        return announcementMapper.updateBatchSelective(list);
    }

    @Override
    public int batchInsert(List<Announcement> list) {
        return announcementMapper.batchInsert(list);
    }

    @Override
    public PageInfo<AnnouncementDTO> findPageByAll(AnnouncementDTO record) {
        List<AnnouncementDTO> announcementDTOList = announcementMapper.findAllByPage(record);
        Integer totalRecord = announcementMapper.findCountByPage(record);
        PageInfo<AnnouncementDTO> pageInfo = new PageInfo<>();
        pageInfo.setPageNum(record.getPageNum());
        pageInfo.setPageSize(record.getPageSize());
        pageInfo.setTotalRecord(totalRecord);
        pageInfo.setResultList(announcementDTOList);
        return pageInfo;
    }

}
